//package com.asset.modules.login.controller;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.asset.modules.common.model.ResponseBean;
//import io.swagger.annotations.Api;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.List;
//
//@RestController
//@CrossOrigin
//@RequestMapping("/dict")
//@Api(tags = "用户字典")
//public class SysDictController {
//    private static final Logger logger = LoggerFactory.getLogger(SysDictController.class);
//
//    @Autowired
//    private SysDictService dictService;
//
//    /**
//     * 查询列表
//     * */
//    @RequestMapping(value = "/page",method = RequestMethod.GET)
//    public ResponseBean list(int pageNum, int pageSize, SysDict dict, HttpServletRequest req) {
//
//        QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(dict, req.getParameterMap());
//        IPage<SysDict> page = dictService.page(new Page(pageNum, pageSize),queryWrapper);
//        return new ResponseBean(HttpStatus.OK.value(), "查询成功(SysDictList Query Successfully.)", page);
//    }
//
//    /**
//     * 查询列表 /根据分组groupName 查询所有字典项
//     * */
//    @RequestMapping(value = "/findAll",method = RequestMethod.GET)
//    public ResponseBean findAll(String dictGroupName){
//        QueryWrapper<SysDict> queryWrapper = new QueryWrapper<>();
//        queryWrapper.eq("dict_group_name",dictGroupName);
//        queryWrapper.orderByAsc("order_no");
//        queryWrapper.orderByAsc("dict_group_name");
//        List<SysDict> list =dictService.list(queryWrapper);
//
//        return new ResponseBean(HttpStatus.OK.value(), "查询成功(SysDictList Query Successfully.)", list);
//    }
//
//    /**
//     * 保存字典项 新增和更新
//     * */
//    @RequestMapping(value = "/save",method = RequestMethod.POST)
//    public ResponseBean save(SysDict dict){
//        dictService.save(dict);
//        return new ResponseBean(HttpStatus.OK.value(), "保存成功(SysDict Saved Successfully.)", dict);
//    }
//
//    /**
//     * 删除字典项组
//     * */
//    @RequestMapping(value = "/deleteGroup",method = RequestMethod.POST)
//    public ResponseBean deleteGroup(SysDict dict){
//        QueryWrapper<SysDict> queryWrapper = new QueryWrapper<>();
//        queryWrapper.eq("dict_group_name",dict.getDictGroupName());
//        dictService.remove(queryWrapper);
//        return new ResponseBean(HttpStatus.OK.value(), "删除成功(SysDict Deleted Successfully.)", null);
//    }
//
//    /**
//     * 删除字典项
//     * */
//    @RequestMapping(value = "/delete",method = RequestMethod.POST)
//    public ResponseBean delete(SysDict dict){
//        dictService.removeById(dict.getDictId());
//        return new ResponseBean(HttpStatus.OK.value(), "删除成功(SysDict Deleted Successfully.)", null);
//    }
//
//}
